package com.yq.tanhua.net

import com.yq.tanhua.net.bean.PageData
import com.yq.tanhua.net.bean.Token
import com.yq.tanhua.net.bean.UserInfo
import com.yq.tanhua.net.dto.MovementDto
import com.yq.tanhua.net.vo.ContractVo
import com.yq.tanhua.net.vo.Movment
import com.yq.tanhua.net.vo.PageInfo
import com.yq.tanhua.net.vo.TodayBest
import okhttp3.MultipartBody
import okhttp3.RequestBody
import org.json.JSONObject
import retrofit2.http.*

/**
 * @author: user
 * @date: 2023/2/28
 */
interface TanHuaApi {
    @POST("/user/login")
    suspend fun sendMsg(@Body body: RequestBody): THApiResult<String>

    @POST("/user/loginVerification")
    suspend fun loginVerification(@Body body: RequestBody): THApiResult<Token>

    @GET("/users/")
    suspend fun getUserInfo(): THApiResult<UserInfo>

    @Multipart
    @POST("/user/loginReginfo/head")
    suspend fun uploadFile(@Part headPhoto: MultipartBody.Part): THApiResult<String>

    @POST("/user/loginReginfo")
    suspend fun saveUserInfo(@Body userInfo: UserInfo): THApiResult<UserInfo>

    @GET("/tanhua/todayBest")
    suspend fun getTodayBest(): THApiResult<TodayBest>


    @GET("/tanhua/recommendation")
    suspend fun getRecommendation(
        @Query("page") page: Int,
        @Query("pagesize") pageSize: Int,
        @Query("gender") gender: String
    ): THApiResult<PageData<TodayBest>>


    @GET("/movements/recommend")
    suspend fun getRecommendMovment(
        @Query("page") page: Int,
        @Query("pagesize") pageSize: Int,
    ): THApiResult<PageData<Movment>>


    @GET("/movements")
    suspend fun getFriendsMovment(
        @Query("page") page: Int,
        @Query("pagesize") pageSize: Int,
    ): THApiResult<PageData<Movment>>

    @Multipart
    @POST("/movements")
    suspend fun publishMovment(
        @Part("textContent") textContent: RequestBody,
        @Part("locationName") locationName: RequestBody,
        @Part imageContent: List<MultipartBody.Part>?,
    ): THApiResult<String?>


    //获取环信信息
    @GET("/huanxin/user")
    suspend fun getHxInfo(): String

    //获取用户信息
    @GET("/tanhua/{id}/personalInfo")
    suspend fun getPersonInfo(@Path("id") id: String): THApiResult<TodayBest>


    @GET("/movements/all")
    suspend fun getMovements(@Query("userId") userId: String): THApiResult<PageInfo<Movment>>

    //查看陌生人问题
    @GET("/tanhua/strangerQuestions")
    suspend fun strangerQuestions(@Query("userId") userId: String): THApiResult<String>

    //回复陌生人信息
    @POST("/tanhua/strangerQuestions")
    suspend fun strangerQuestions(@Body body: RequestBody): THApiResult<String>

    //添加联系人
    @POST("/messages/contacts")
    suspend fun addContacts(@Body body: RequestBody): THApiResult<String>

    //联系人列表
    @GET("/messages/contacts")
    suspend fun contactsList(): THApiResult<PageInfo<ContractVo>>
}